package com.example.villagedevelop.generator.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.villagedevelop.generator.entity.ImageHomeStay;
import com.example.villagedevelop.generator.mapper.ImageHomeStayMapper;
import com.example.villagedevelop.generator.service.ImageHomeStayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ImageHomeStayServiceImpl extends ServiceImpl<ImageHomeStayMapper, ImageHomeStay> implements ImageHomeStayService {

    @Autowired
    ImageHomeStayMapper mapper;

    //根据sid查找images
    @Override
    public List<String> getImagesBySid(Integer sid) {
        List<String> imagess = new ArrayList<>();
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("s_id",sid);
        List<ImageHomeStay> images = mapper.selectList(wrapper);

        for (ImageHomeStay image : images){
            imagess.add(image.getImageFile());
        }
        return imagess;
    }




}
